﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using Sebastof.Services.Interfaces;

#endregion

namespace InterLinq.Test {
	/// <summary>
	/// represents a order position within a <see cref="Order"/>
	/// </summary>
	[Serializable]
	public class InterLinqOrderPosition : SebastofApplicationObject, IOrderPosition {
		#region Public Properties

		/// <summary>
		/// Gets the product of this order position
		/// </summary>
		public IProduct Product {
			get { return GetValue<IProduct>("Product"); }
			set { SetValue("Product", value); }
		}

		/// <summary>
		/// gets the how many article of the <see cref="Product"/> are sold
		/// </summary>
		public int Count {
			get { return GetValue<int>("Count"); }
			set { SetValue("Count", value); }
		}

		#endregion

		#region Public Methods

		/// <summary>
		/// ctr
		/// </summary>
		/// <param name="count">how many of the given product is sold</param>
		/// <param name="product">the product</param>
		public InterLinqOrderPosition(int count, IProduct product) {
			Product = product;
			Count = count;
			Id = Guid.NewGuid().ToString();
		}

		public InterLinqOrderPosition() {
			Id = Guid.NewGuid().ToString();
		}

		#endregion

		#region IOrderPosition Members

		Guid IOrderPosition.Id {
			get { return new Guid(base.Id); }
			set { base.Id = value.ToString(); }
		}

		#endregion
	}
}